package com.bigmi.apis.schedule;

import com.bigmi.model.common.dtos.ResponseResult;
import com.bigmi.model.schedule.dto.Task;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@FeignClient("newsweb-schedule")
public interface CheduleClientIP {
    /**
     * 添加任务
     * @param task
     * @return
     */
    //返回任务id，id为long类型
    @PostMapping("api/v1/task/add")
    public ResponseResult addTask(@RequestBody Task task);
    /**
     * 取消任务
     */
    @GetMapping("api/v1/task/{taskId}")
    public ResponseResult cancelTask(@PathVariable("taskId") long taskId);
    /**
     * 消费任务，在list中拉取
     *按照类型和优先级拉取任务
     */
    @GetMapping("api/v1/task/{type}/{priority}")
    public ResponseResult poll(@PathVariable("type") int type ,@PathVariable("priority") int priority);
}
